'''
# @Title:
# @Time : 2022/3/21 11:29
# @File : file_tools.py
# @Software: PyCharm

'''
import os

import yaml


class FileTools:

    @classmethod
    def get_interface_dir(cls):
        # 获取ApiObject的文件夹路径
        return os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

    @classmethod
    def read_yaml(cls, file_name):
        # 获取api_object的文件夹地址
        _path = cls.get_interface_dir()
        # 拼接yaml文件所在的绝对路径
        # os.sep的参数需要的是列表，作用是把列表中的路径拼接起来，且会自动识别当前系统下的文件路径符，windows是\, Linux是/
        yaml_file = os.sep.join([_path, "data", file_name + ".yaml"])
        with open(yaml_file,encoding='utf-8') as f:
            return yaml.safe_load(f)



if __name__ == '__main__':
    print(FileTools.read_yaml("corp_data"))